Skip to content

Conversation

@barbacbd
Copy link
Contributor

@barbacbd barbacbd commented Sep 17, 2025

What type of PR is this?

/kind feature

What this PR does / why we need it

** This is a regression for the openshift installer.

Instead of filling this value in, the default will be 64 (so that this is backwards compatible), otherwise the user can provide this information in the cluster spec.

** MinPortsPerVM: Minimum number of ports allocated to a VM from this NAT config. If not set, a default number of ports is allocated to a VM. This is rounded up to the nearest power of 2. For example, if the value of this field is 50, at least 64 ports are allocated to a VM.

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #

https://issues.redhat.com/browse/OCPBUGS-61876

Special notes for your reviewer:

Please confirm that if this PR changes any image versions, then that's the sole change this PR makes.

TODOs:

  • squashed commits
  • includes documentation
  • adds unit tests

Release note:

MinPortsPerVM is the minimum number of ports allocated to a VM from this NAT config. If not set, a default number of ports is allocated to a VM. This is rounded up to the nearest power of 2. For example, if the value of this field is 50, at least 64 ports are allocated to a VM. 

@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. kind/feature Categorizes issue or PR as related to a new feature. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Sep 17, 2025
@k8s-ci-robot
Copy link
Contributor

Hi @barbacbd. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@k8s-ci-robot k8s-ci-robot requested a review from damdo September 17, 2025 19:57
@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Sep 17, 2025
@netlify
Copy link

netlify bot commented Sep 17, 2025

Deploy Preview for kubernetes-sigs-cluster-api-gcp ready!

Name Link
🔨 Latest commit 8fba12f
🔍 Latest deploy log https://app.netlify.com/projects/kubernetes-sigs-cluster-api-gcp/deploys/68d5505632223900085a0171
😎 Deploy Preview https://deploy-preview-1531--kubernetes-sigs-cluster-api-gcp.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@k8s-ci-robot k8s-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Sep 17, 2025
@damdo
Copy link
Member

damdo commented Sep 18, 2025

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Sep 18, 2025
@damdo damdo changed the title OCPBUGS-61876: Provide a MinPortsPerVM for Nat Router Provide a MinPortsPerVM for Nat Router Sep 18, 2025
@barbacbd
Copy link
Contributor Author

We are choosing to only allow the MinPortsPerVM because the DynamicPortAllocation is not allowed in the current CAPG configuration. This means that dynamic port allocation is set to false. MinPortsPerVM expects the dynamic port allocation to be false while MaxPortsPerVM expects the value to be set to true. In the future, if MaxPortsPerVM is to be added, we need to also add EnableDynamicPortAllocation.

** This is a regression for the openshift installer.

Instead of filling this value in, the default will be 64 (so that this is backwards compatible), otherwise
the user can provide this information in the cluster spec.

** MinPortsPerVM: Minimum number of ports allocated to a VM from this NAT
config. If not set, a default number of ports is allocated to a VM. This is
rounded up to the nearest power of 2. For example, if the value of this
field is 50, at least 64 ports are allocated to a VM.
Copy link
Member

@damdo damdo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/approve

/assign @salasberryfin @justinsb @cpanato

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: barbacbd, damdo

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 25, 2025
Mtu int64 `json:"mtu,omitempty"`

// MinPortsPerVM: Minimum number of ports allocated to a VM from this NAT
// config. If not set, a default number of ports is allocated to a VM. This is
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: we might want to specify that this is configured on the Nat Router, I wasn't entirely sure what this doing otherwise. But it's only a comment, so not a blocker IMO.

Name: fmt.Sprintf("%s-%s", networkSpec.Name, "nat"),
NatIpAllocateOption: "AUTO_ONLY",
SourceSubnetworkIpRangesToNat: "ALL_SUBNETWORKS_ALL_IP_RANGES",
MinPortsPerVm: s.GCPCluster.Spec.Network.MinPortsPerVM,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So how does defaulting work here with existing objects? I guess worst-case (default not applied) the code does the same thing it did before (and 64 is also the default on the NatRouter, I believe, so we shouldn't be changing the actual value in GCP either)

@justinsb
Copy link
Contributor

Some questions about defaulting, but I think because of your clever choices of defaults they don't actually matter here.

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Sep 28, 2025
@justinsb
Copy link
Contributor

/test pull-cluster-api-provider-gcp-apidiff

I worry that I've broken our apidiff test - or at least broken it printing nice error messages...

@k8s-ci-robot k8s-ci-robot merged commit baa3f03 into kubernetes-sigs:main Sep 28, 2025
16 of 17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/feature Categorizes issue or PR as related to a new feature. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants